package com.huobao.yunying.update;

import java.io.File;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
public class ClickNotifitionReceiver extends BroadcastReceiver {

	@Override
	public void onReceive(Context arg0, Intent arg1) {
		if(arg1.getAction().equals("com.android.CLICK_NOTIFITION")){
			if(UpdateDownloadUtil.downloadFinish){
				installAPK(arg0, UpdateDownloadUtil.apkPathFile);
			}
		}
	}
	
	private void installAPK(Context c, File path) {
		Intent install = new Intent();
		install.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
		install.setAction(Intent.ACTION_VIEW);
		install.setDataAndType(Uri.fromFile(path),
				"application/vnd.android.package-archive");
		c.startActivity(install);// ��װ
	}

}
